package dao.impl;

import dao.IManagerDao;
import model.Manager;
import model.Order;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public class ManagerDao implements IManagerDao {
    @Autowired
    private SqlSession sqlSession;
    @Override
    public List<Manager> query(Manager manager) {
        String url = "dao.IManagerDao.";
        return  sqlSession.selectList(url+"query",manager);
    }

    @Override
    public int add(Manager manager) {
        return sqlSession.insert("dao.IManagerDao.add", manager);
    }

    @Override
    public int on(Manager manager) {
        return  sqlSession.update("dao.IManagerDao.on", manager);
    }

    @Override
    public int off(Manager manager) {
        return sqlSession.update("dao.IManagerDao.off", manager);
    }

    @Override
    public int totalCount(Manager manager) {
        return sqlSession.selectOne("dao.IManagerDao.totalCount", manager);
    }


}
